
project(CuFieldTranslate CUDA CXX)
set(CMAKE_CUDA_ARCHITECTURES native)

# 设置编译标准
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CUDA_STANDARD 17)
set(CMAKE_CUDA_STANDARD_REQUIRED ON)

link_libraries(${CMAKE_SOURCE_DIR}/out/build/CuDGGS/CuLibDGGSKernel)

include_directories(${CMAKE_SOURCE_DIR}/3rdlibs/include)
link_directories(${CMAKE_SOURCE_DIR}/3rdlibs/lib)

if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
    message(STATUS "Configuring for Linux")
    find_package(GDAL REQUIRED)
    include_directories(${GDAL_INCLUDE_DIRS})
endif()

add_executable(CuFieldTranslate
        main.cu
        CuFieldTranslate.cu
        Common.cu
)

set_target_properties(CuFieldTranslate PROPERTIES CUDA_SEPARABLE_COMPILATION ON)

if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
    target_include_directories(CuFieldTranslate PRIVATE ${GDAL_INCLUDE_DIRS})
    target_link_libraries(CuFieldTranslate PRIVATE
            ${GDAL_LIBRARIES}
            LibGridTIFF
            CuLibDGGSKernel
            stdc++
            stdc++fs
            m
    )
elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows")
    if (CMAKE_BUILD_TYPE STREQUAL "Debug")
        target_link_libraries(CuFieldTranslate
                LibGridTIFF
                CuLibDGGSKernel
                gdal_i
        )
    else ()
        target_link_libraries(CuFieldTranslate
                LibGridTIFF
                CuLibDGGSKernel
                gdal_i
        )
    endif ()


endif()


add_dependencies(CuFieldTranslate CuLibDGGSKernel)